<template>
	<view class="pageBox">
		<view class="amount">
			<view class="amountTitle flex-center">
				持有仓单
			</view>
			<view class="amountTitle flex-center">
				{{total}}张
			</view>


			<view class="main">
				<view class="listBox">
					<view class="listTitle flex-row">
						<view class="title flex-row">
							交易所
						</view>
						<view class="title flex-row">
							票类
						</view>
						<view class="title flex-row">
							数量
						</view>
					</view>

					<view class="list">
						<!--  @click.stop="goDetails" -->
						<view class="listItem flex" v-for="(item,index) in list" :key="index">
							<view class="item flex-row">
								{{item.label}}
							</view>
							<view class="item flex">
								<view class="itemText" v-for="(child,cIndex) in item.children" :key="cIndex">
									{{child.label}}
								</view>

							</view>
							<view class="item flex">
								<view class="itemText" v-for="(child,cIndex) in item.children" :key="cIndex">
									{{child.num}} 张
								</view>
							</view>
						</view>
					</view>
					<u-loadmore :status="status" />
				</view>
			</view>
		</view>




	</view>
</template>

<script>
	export default {
		data() {
			return {
				lastId: 0,
				page: 1,
				list: [],
				end: false,
				status: 'loadmore',
				total: ''
			}
		},
		onLoad() {
			this.getList()
		},
		onReachBottom() {
			this.getList()
		},
		methods: {
			// goDetails() {
			// 	uni.navigateTo({
			// 		url: '/pages/my/normalDetails'
			// 	})
			// },
			getList() {
				if (this.end) {
					return
				}
				this.$post({
					module: 'Exchange',
					interface: 5006,
					data: {
						lastId: this.lastId,
						page: this.page,
					}
				}).then(res => {
					// console.log(res);
					this.list = [...this.list, ...res.list]
					this.total = res.total
					if (res.list.length < 10) {
						this.end = true
					}
					if (res.list.length < 10) {
						this.status = 'nomore';
					} else {
						this.status = 'loading';
					}
					this.page++
					this.lastId = res.lastId
				})
			}

		},
	}
</script>

<style scoped lang="scss">
	.pageBox {
		width: 100%;
		min-height: calc(100vh - var(--window-top));
		background-color: #ffffff;

		.amount {
			width: 100%;
			height: 288rpx;
			background-image: url("http://www.bobei.shop/static/third/topHeadBg.png");
			background-repeat: no-repeat;
			background-size: 100% 100%;
			padding-top: 60rpx;
			position: relative;

			.amountTitle {
				font-size: 36rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: normal;
				color: #FFFFFF;
				margin-top: 16rpx;
			}

			.main {
				width: 100%;
				background: #FFFFFF;
				border-radius: 24rpx 24rpx 0px 0px;
				position: absolute;
				left: 0;
				top: 268rpx;
				z-index: 1;
				padding: 0 30rpx;



				.listBox {
					width: 100%;
					margin-top: 38rpx;

					.listTitle {
						.title {
							font-size: 36rpx;
							font-family: PingFangSC-Regular, PingFang SC;
							font-weight: bold;
							color: #000000;
							line-height: 40rpx;
						}

						.title:nth-of-type(1) {
							width: 26%;
						}

						.title:nth-of-type(2) {
							width: 38%;
						}

						.title:nth-of-type(3) {
							width: 36%;
						}
					}

					.list {
						padding-top: 20rpx;

						.listItem {
							align-items: flex-start;
							.item {
								font-size: 28rpx;
								font-family: PingFangSC-Regular, PingFang SC;
								font-weight: 400;
								color: #000000;
								line-height: 40rpx;
								margin-top: 28rpx;
								word-break: break-all;

								.itemText {
									font-size: 28rpx;
									font-family: PingFangSC-Regular, PingFang SC;
									font-weight: 400;
									color: #000000;
									word-break: break-all;
								}
							}

							.item:nth-of-type(1) {
								width: 26%;
							}

							.item:nth-of-type(2) {
								width: 38%;
								flex-direction: column;
							}

							.item:nth-of-type(3) {
								width: 36%;
								flex-direction: column;
							}
						}
					}
				}
			}
		}







	}
</style>
